package com.css.crm.vo;

import java.util.Date;

/**
 * Virtual object UserInfo to store user information
 */
/*
 * Log			Date			Name					Description
 * 0024746	 	2012 DEC 18		lawrence.ng.c.k			Creation
 */
public class UserInfo implements Comparable<UserInfo>{
	private AbstractUser user;
	private String lastAccessViewId;
	private Date lastAccessTime;

	public UserInfo(AbstractUser user) {
		this.user = user;
	}

	public String getLastAccessViewId() {
		return lastAccessViewId;
	}

	public void setLastAccessViewId(String lastAccessViewId) {
		this.lastAccessViewId = lastAccessViewId;
	}

	public Date getLastAccessTime() {
		return lastAccessTime;
	}
	
	public void setLastAccessTime(Date lastAccessTime) {
		this.lastAccessTime = lastAccessTime;
	}

	public AbstractUser getUser() {
		return user;
	}

	public void setUser(AbstractUser user) {
		this.user = user;
	}

	public int compareTo(UserInfo o) {
		if ( o != null ){
			return this.lastAccessTime.compareTo(o.lastAccessTime);
		}
		return 0;
	}

	/**
	 * Return details of user information as a string
	 * @return String that represents details of user information
	 */
	/*
	 * Log			Date			Name					Description
	 * 0024746	 	2012 DEC 18		lawrence.ng.c.k			Creation
	 */
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("UserInfo [user=").append(user).append(", lastAccessViewId=").append(lastAccessViewId).append(", lastAccessTime=").append(lastAccessTime).append("]");
		return builder.toString();
	}
}
